]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ShellGlobal: use a different window for IBus when running on wayland
authorGiovanni Campagna <gcampagn@redhat.com>
Wed, 11 Sep 2013 15:53:58 +0000 (17:53 +0200)
committerGiovanni Campagna <gcampagn@redhat.com>
Thu, 12 Sep 2013 08:34:25 +0000 (10:34 +0200)
When running as a wayland compositor, the clutter stage doesn't
have an usable window for IPC, so just create another one.

Also, disable freezing the keyboard when running on wayland, as
we can't do it really.

https://bugzilla.gnome.org/show_bug.cgi?id=707467

src/shell-global.c

index 65994ec95dc63b409de73e1f21f3b295a345acb0..97cdebd2c9a2b68322fa03696598780f50ac7d02 100644 (file)
@@ -847,9 +847,36 @@ _shell_global_set_plugin (ShellGlobal *global,
                                                meta_screen_get_screen_number (global->meta_screen));
 
   global->stage = CLUTTER_STAGE (meta_get_stage_for_screen (global->meta_screen));
-  global->stage_xwindow = clutter_x11_get_stage_window (global->stage);
-  global->ibus_window = gdk_x11_window_foreign_new_for_display (global->gdk_display,
-                                                                global->stage_xwindow);
+
+#ifdef HAVE_WAYLAND
+  if (meta_is_wayland_compositor ())
+    {
+      /* When Mutter is acting as its own display server then the
+         stage does not have a window, so create a different window
+         which we use to communicate with IBus, and leave stage_xwindow
+         as None.
+      */
+
+      GdkWindowAttr attributes;
+
+      attributes.wclass = GDK_INPUT_OUTPUT;
+      attributes.width = 100;
+      attributes.height = 100;
+      attributes.window_type = GDK_WINDOW_TOPLEVEL;
+
+      global->ibus_window = gdk_window_new (NULL,
+                                            &attributes,
+                                            0 /* attributes_mask */);
+      global->stage_xwindow = None;
+    }
+  else
+#endif
+    {
+      global->stage_xwindow = clutter_x11_get_stage_window (global->stage);
+      global->ibus_window = gdk_x11_window_foreign_new_for_display (global->gdk_display,
+                                                                    global->stage_xwindow);
+    }
+
   st_im_text_set_event_window (global->ibus_window);
 
   g_signal_connect (global->stage, "notify::width",
@@ -954,7 +981,8 @@ void
 shell_global_freeze_keyboard (ShellGlobal *global,
                               guint32      timestamp)
 {
-  meta_display_freeze_keyboard (global->meta_display, global->stage_xwindow, timestamp);
+  if (global->stage_xwindow != None)
+    meta_display_freeze_keyboard (global->meta_display, global->stage_xwindow, timestamp);
 }
 
 /* Code to close all file descriptors before we exec; copied from gspawn.c in GLib.